import Mock from 'mockjs'
import '@/mock/extend'
import {parseUrlParams} from '@/utils/request'
// const Random = Mock.Random;
const source={
  name:['温度(℃)', '密度(Kg/m³)', '粘度(Cst)', '介电常数(F/m)', '含水量(%)'],
  date:['2024/03/21 ', '2024/03/22 ', '2024/03/23', '2024/03/24', '2024/03/25', '2024/03/26', '2024/03/27'],
  series:[
    {
      name: '温度(℃)',
      type: 'line',
      stack: 'Total',
      symbol: 'none',
      data: [10, 20, 50, 20, 30, 1, 40]
    },
    {
      name: '密度(Kg/m³)',
      type: 'line',
      stack: 'Total',
      symbol: 'none',
      data: [20, 82, 1, 34, 20, 30, 30]
    },
    {
      name: '粘度(Cst)',
      type: 'line',
      stack: 'Total',
      symbol: 'none',
      data: [50, 22, 21, 14, 1, 33, 10]
    },
    {
      name: '介电常数(F/m)',
      type: 'line',
      stack: 'Total',
      symbol: 'none',
      data: [20, 32, 1, 34, 39, 30, 20]
    },
    {
      name: '含水量(%)',
      type: 'line',
      stack: 'Total',
      symbol: 'none',
      data: [20, 32, 1, 40, 90, 13, 30]
    }
  ]
}
Mock.mock(RegExp(`${process.env.VUE_APP_API_BASE_URL}/history` + '.*'),'get', ({url}) => {
  const params = parseUrlParams(decodeURI(url))
  let {type} = params
  console.log(type)
  return {
    code: 0,
    message: 'success',
    data:source
  }
})
